package net.magicalcloud.magicalcloud.view.viewImpl.activity;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import net.magicalcloud.magicalcloud.R;

import cn.jzvd.JZVideoPlayer;
import cn.jzvd.JZVideoPlayerStandard;

import static net.magicalcloud.magicalcloud.util.MyUtil.getFileName;

public class MediaPlayerActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_media_player);

        Bundle bundle=getIntent().getBundleExtra(getPackageName());
        String url=bundle.getString("videoUrl");
        String title=getFileName(bundle.getString("videoTitle"));

        JZVideoPlayerStandard jzVideoPlayerStandard = findViewById(R.id.videoplayer);
        jzVideoPlayerStandard.setUp(url, JZVideoPlayerStandard.SCREEN_WINDOW_NORMAL,title);

    }

    @Override
    public void onBackPressed() {
        if (JZVideoPlayer.backPress()) {
            return;
        }
        super.onBackPressed();
    }
    @Override
    protected void onPause() {
        super.onPause();
        JZVideoPlayer.releaseAllVideos();
    }
}
